home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / misc / scion409 / scionarexx.lha / PeopleList.rexx < prev    next >
OS/2 REXX Batch file  |  1993-10-24  |  7KB  |  241 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                            PeopleList.rexx                               */
  4. /*                                                                          */
  5. /* Written by: Peter Billing, RMB 1240, Yinnar 3869, Australia              */
  6. /*                                                                          */
  7. /* Last saved: Wednesday 29-Sep-93                                          */
  8. /*                                                                          */
  9. /* This program should LIST ALL the people in the SCION database. The       */
  10. /* database must be running for this AREXX script to work.                  */
  11. /*                                                                          */
  12. /****************************************************************************/
  13.  
  14. /* Return the Database Name */
  15.  
  16. options results
  17. /*test = show('P','SCIONGEN')
  18. if test = 0  then
  19. say
  20. say "I am sorry to say that the SCION Genealogist database is not available."
  21. say "Please start the SCION program BEFORE using this script."
  22. say
  23. exit */
  24.  
  25. myport = "SCIONGEN"
  26. address value myport
  27. getdbname
  28. dbname = result
  29. output = "STDOUT"
  30. heading = "Listing of ALL the people in the" dbname "database on" date()
  31. say " "
  32. writeln(output,center("This script will give you a",80))
  33. writeln(output,center(heading,80))
  34. say center("The screen output DOES NOT include marriages",80)
  35. say center("but the file option does. This makes the line longer",80)
  36. say center("than 80 characters so it will need to be printed in",80)
  37. say center("compressed mode.",80)
  38. writech(stdout,"Output to Screen or File S/F ")
  39. pull out
  40. if out = "" then out = "S"
  41. writech(stdout,"Do you want a sorted list Y/N ")
  42. pull sorted
  43. if sorted = "" then sorted = "N"
  44. maximum = 0
  45. do number = 1 to 100
  46.    nametable.number = ""
  47.    end
  48. gettotalirn
  49. total = result
  50.  
  51. /* total = 12 */
  52.  
  53. if sorted = "Y" then do
  54.   file_name = "ram:sort"
  55.   open(sort_File,file_Name,"w")
  56.   do a = 1 to total
  57.     getlastname a
  58.     person = upper(result)
  59.     getfirstname a
  60.     person = person result a
  61.     writeln(sort_File,person)
  62.   end
  63.   close(sort_file)
  64.   address command "c:sort ram:sort ram:sort2"
  65.   file_name = "ram:sort2"
  66.   open(sort_File,file_Name,"r")
  67. end
  68.  
  69. if out = "S" then do
  70.   output = "STDOUT"
  71.   cen = 80
  72. end
  73. if out = "F" then do
  74.    filename = "RAM:PeopleList_"dbname".Scion"
  75.    open(w_file,filename,"w")
  76.    output = w_file
  77.    writeln(stdout,"")
  78.    writeln(stdout,"Writing file to" filename)
  79.    cen = 106
  80. end
  81.  
  82. writeln(output,"w" center(heading,cen))
  83. writeln(output,"")
  84. if out = "F" then do
  85.   writeln(output, "IRN LASTNAME        FIRSTNAME                SEX   BIRTH     PLA  DEATH    PLA  MARRIAGES           PARENTS")
  86.   writeln(output, "-----------------------------------------------------------------------------------------------------------")
  87.   end
  88.   else do
  89.   writeln(output, "IRN LASTNAME       FIRSTNAME    SEX   BIRTH     PLA  DEATH    PLA  PARENTS")
  90.   writeln(output, " -------------------------------------------------------------------------")
  91.   end
  92. do i = 1 to total
  93. if sorted = "Y" then do
  94.   person = readln(sort_file)
  95.   x = word(person,words(person))
  96. end
  97. else do
  98.   x = i
  99. end
  100. if out = "F" then do
  101.   if i/5 = i%5 then writech(stdout,".")
  102.   if i/55 = i%55 then do
  103.     writeln(output," " center(heading,cen))
  104.     writeln(output,"")
  105.     writeln(output, "IRN LASTNAME        FIRSTNAME                SEX   BIRTH     PLA  DEATH    PLA  MARRIAGES           PARENTS")
  106.     writeln(output, "-----------------------------------------------------------------------------------------------------------")
  107.   end
  108. end
  109. getlastname x
  110. lastname = result
  111. getfirstname x
  112. firstname = result
  113. getsex x
  114. sex = result
  115. getbirthdate x
  116. birthdate = result
  117. getdeathdate x
  118. deathdate = result
  119. getparents x
  120. parents = result
  121. getprincipal parents
  122. principal = result
  123. getspouse parents
  124. spouse = result
  125. getbirthplace x
  126. makeplacenumber(result)
  127. birthplace = number
  128. getdeathplace x
  129. makeplacenumber(result)
  130. deathplace = number
  131. if out = "F" then do
  132.   writech(output, right(x,3) left(lastname,15) left(firstname,25) left(sex,2) right(birthdate,10) right(birthplace,3) right(deathdate,10) right(deathplace,3))
  133.   end
  134.   else do
  135.   writech(output, right(x,3) left(lastname,12) left(firstname,15) left(sex,2) right(birthdate,10) right(birthplace,3) right(deathdate,10) right(deathplace,3))
  136.   end
  137. if out = "F" then do
  138.   do f = 0 to 4
  139.     getmarriage x f
  140.     writech(output,right(result,4))
  141.   end
  142.   end
  143. writeln(output,right(principal,4) right(spouse,4))
  144. end
  145.  
  146. gettotalfgrn
  147. total = result
  148. if out = "F" then do
  149.   writeln(stdout,"")
  150.   writeln(stdout,"Writing Marriages")
  151.   writeln(output," ")
  152.   end
  153. writeln(output,centre("Marriages",cen))
  154. writeln(output,"")
  155. writeln(output,"FGRN     DATE      PLA HUSB WIFE                  FGRN     DATE      PLA HUSB WIFE")
  156. do x = 1 to (total + 1) / 2
  157.    a = (total + 1) % 2 + x
  158.    /* say x a */
  159. if out = "F" then do
  160.   if x/5 = x%5 then writech(stdout,".")
  161.   if x/55 = x%55 then do
  162.     writeln(output," " center(heading,cen))
  163.     writeln(output,"")
  164.     writeln(output,centre("Marriages",cen))
  165.     writeln(output,"")
  166.     writeln(output,"FGRN     DATE      PLA HUSB WIFE                  FGRN     DATE      PLA HUSB WIFE")
  167.   end
  168. end
  169. getmarrydate x
  170. marrydate = result
  171. getmarryplace x
  172. makeplacenumber(result)
  173. marryplace = number
  174. getprincipal x
  175. principal = result
  176. getspouse x
  177. spouse = result
  178.   writech(output,right(x,4) right(marrydate,12) right(marryplace,4) right(principal,4) right(spouse,4))
  179. getmarrydate a
  180. marrydate = result
  181. getmarryplace a
  182. makeplacenumber(result)
  183. marryplace = number
  184. getprincipal a
  185. principal = result
  186. getspouse a
  187. spouse = result
  188.   writeln(output,right(a,22) right(marrydate,12) right(marryplace,4) right(principal,4) right(spouse,4))
  189. end
  190.  
  191. if out = "F" then writeln(output," ")
  192. writeln(output,center(heading,cen))
  193. writeln(output,"")
  194. writeln(output,center("Place Names",cen))
  195. writeln(output,"")
  196. do x = 1 to (maximum + 1) / 2
  197.   a = (maximum + 1) % 2+x
  198.   if out = "F"    then do
  199.     writeln(output,right(x,4) left(nametable.x,50) right(a,4)  left(nametable.a,50))
  200.   end
  201.   else do
  202.     writeln(output,right(x,4) left(nametable.x,32) right(a,4)  left(nametable.a,32))
  203.   end
  204.   if out = "F" then do
  205.     if x/55 = x%55 then do
  206.       writeln(output," " center(heading,cen))
  207.       writeln(output,"")
  208.       writeln(output,center("Place Names",cen))
  209.       writeln(output,"")
  210.     end
  211.   end
  212. end
  213.  
  214. if out = "F" then do
  215.   writeln(output," ")
  216.   close(w_file)
  217.   writeln(stdout,"")
  218.   writeln(stdout,"All Finished")
  219.   end
  220.  
  221. exit
  222.  
  223.  
  224. MakePlaceNumber:
  225. parse arg name
  226. number = 0
  227. /* nametable.3 = "" */
  228. /* say name
  229. say nametable.number */
  230. do until nametable.number = "" | nametable.number = name
  231.   number = number +1
  232.   if number > maximum then maximum = number
  233. end
  234. if nametable.number = "" then do
  235.   nametable.number = name
  236. end
  237.  
  238. if name = "" then number = ""
  239. return number
  240.  
  241.